import request from "@/utils/request";
import { AxiosPromise } from "axios";
import { DeviceDataPageResult, DeviceDataQuery } from "./datatypes";

/**
 * 获取设备实时分页数据
 *
 * @param queryParams
 */
export function getDeviceDataPage(
  queryParams?: DeviceDataQuery
): AxiosPromise<DeviceDataPageResult> {
  return request({
    url: "/api/v1/device/data/page",
    method: "get",
    params: queryParams,
  });
}

/**
 * 导出设备实时数据
 *
 * @param queryParams
 * @returns
 */
export function exportDeviceData(queryParams: DeviceDataQuery) {
  return request({
    url: '/api/v1/device/data/export',
    method: 'get',
    params: queryParams,
    responseType: 'arraybuffer'
  });
}
